package com.lsl.strategy_pattern.dto;

import com.lsl.strategy_pattern.service.AttackBehavior;
import com.lsl.strategy_pattern.service.SpeedBehavior;

/**
 * 动物属性
 *
 * @author liusl104
 */
public abstract class Character {
    private AttackBehavior attackBehavior;
    private SpeedBehavior speedBehavior;


    /**
     * 注入攻击行为  共性行为
     */
    public void attack() {
        attackBehavior.attack();
    }

    /**
     * 注入速度行为  共性行为
     */
    public void speed() {
        speedBehavior.speed();
    }

    public void setAttackBehavior(AttackBehavior attackBehavior) {
        this.attackBehavior = attackBehavior;
    }

    public void setSpeedBehavior(SpeedBehavior speedBehavior) {
        this.speedBehavior = speedBehavior;
    }

    /**
     * 特异性行为
     */
    abstract void display();
}
